import { AwakeSystem } from "../../../../../Core/Module/EventSystem/IAwakeSystem";
import { FriendOf, ObjectSystemAttribute } from "../../../../../Decorator/Decorator";
import { FUIGlobalComponent } from "../../../../ModelView/Client/Demo/Global/FUIGlobalComponent";

@FriendOf(FUIGlobalComponent)
@ObjectSystemAttribute()
export class FUIGlobalComponentAwakeSystem extends AwakeSystem<FUIGlobalComponent> {

    Awake(self: FUIGlobalComponent): void {
        FUIGlobalComponent.Instance = self;

        self.Global = cc.find("Canvas/Global");
        self.Unit = cc.find("Canvas/Global/UnitRoot");

        fgui.GRoot.create();

        self.GRoot = fgui.GRoot.inst;

        self.NormalGRoot = new fgui.GComponent();
        self.NormalGRoot.name = "NormalGRoot";
        fgui.GRoot.inst.addChild(self.NormalGRoot);

        self.PopUpGRoot = new fgui.GComponent();
        self.PopUpGRoot.name = "PopUpGRoot";
        fgui.GRoot.inst.addChild(self.PopUpGRoot);

        self.FixedGRoot = new fgui.GComponent();
        self.FixedGRoot.name = "FixedGRoot";
        fgui.GRoot.inst.addChild(self.FixedGRoot);

        self.OtherGRoot = new fgui.GComponent();
        self.OtherGRoot.name = "OtherGRoot";
        fgui.GRoot.inst.addChild(self.OtherGRoot);
    }

}